<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .container {
            width: 10em;
            height: 10em;
            position: relative;
            display: flex;
            align-items: center;
            /*弹性盒子元素在该行的侧轴（纵轴）上居中放置*/
            justify-content: center;
            /*项目位于容器的中心*/
            border-radius: 1em;
        }
        .container:nth-child(2) {
            top: -6em;
            left: 4em;
        }
        .sub {
            width: 7em;
            height: 7em;
            border-radius: 0.5em;
        }
        .container:nth-child(1) {
            background-color: lightgreen;
        }
        .container:nth-child(2) {
            background-color: moccasin;
        }
        .container:nth-child(1) .sub {
            background-color: green;
        }
        .container:nth-child(2) .sub {
            background-color: orange;
        }
        /*如果注释下面的z-index设置则是黄色在上绿色在下*/
        .container:nth-child(1) {
            z-index: 2;
        }
        .container:nth-child(2) {
            z-index: 1;
        }
        .container:nth-child(1) .sub {
            z-index: 3;
        }
        .container:nth-child(2) .sub {
            z-index: 4;
        }
    </style>
</head>
<body>
    <figure>
        <div class="container">
            <div class="sub"></div>
        </div>
        <div class="container">
            <div class="sub"></div>
        </div>
    </figure>
</body>
</html>